#! /bin/bash
#
# bzfs          Start/Stop a BZFlag server
#
# chkconfig: 2345 50 50
# description: bzfs is the server for the 3D multiplayer tank game BZFlag.

# Source function library.
. /etc/init.d/functions

RETVAL=0


prog="bzfs"

# Set this path to the place where you keep the bzfsd script
bzfsd_path=/usr/local/bin/bzfsd

# Set this to your bzfs options
bzfsopts="-conf /etc/bzfs.conf"


start() {
	gprintf "Starting %s: " "$prog"
	daemon $bzfsd_path $bzfsopts
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
	return $RETVAL
}

stop() {
	gprintf "Stopping %s: " "$prog"
	killproc $prog
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
	return $RETVAL
}

rhstatus() {
	status $prog
}

restart() {
	stop
	start
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart)
	restart
	;;
  status)
	rhstatus
	;;
  condrestart)
	[ -f /var/lock/subsys/$prog ] && restart || :
	;;
  *)
	gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" "$0"
	exit 1
esac

exit $?

